function getCookies(cookieName, subcookieName) {

    if (subcookieName != null && subcookieName != "") {
        var re = new RegExp(cookieName + "=(?:.*?&)*?" + subcookieName + "=([^&;$]*)", "i");

        returnValue = re.test(decodeURI(this.document.cookie)) ? RegExp["$1"] : "";
    }
    else {
        returnValue = (typeof cookies[cookieName] !== 'undefined') ? getCookies[cookieName] : null;
    }

    return returnValue;

}